import { http } from "@/utils/http";
import { baseUrlApi } from "@/store/utils";

//----------------------------------------项目订单----------------------------------------//
//获取项目订单列表
export const getprojectOrderlist = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/list"), { params });
};

//获取订单付款节点
export const getPaymentNodeList = (params?: object) => {
  return http.request("get", baseUrlApi("ptsettlement/paynode/list"), { params });
};

//获取供应商结算付款节点
export const getGysPaymentNodeList = (params?: object) => {
  return http.request("get", baseUrlApi("settlement/paynode/list"), { params });
};

//获取项目订单信息详情
export const getprojectOrderinfo = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/info"), { params });
};

//获取项目订单订单材料信息
export const getmateriallist = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/material/list"), {
    params
  });
};

// 获取项目订单材料信息统计数据
export const getmaterialstatistics = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/material/list/count"), {
    params
  });
};

//获取项目订单收货人信息
export const getconsigneelist = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/consignee/list"), {
    params
  });
};

//保存/编辑项目订单(id存在为编辑)
export const projectOrdersaveOrUpdate = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/saveOrUpdate"), {
    data
  });
};

///编辑项目收货人(id存在为编辑)
export const consigneesaveOrUpdate = (data?: object) => {
  return http.request(
    "post",
    baseUrlApi("projectOrder/consignee/saveOrUpdate"),
    { data }
  );
};

///编辑项目材料(id存在为编辑)
export const materialaveOrUpdate = (data?: object) => {
  return http.request(
    "post",
    baseUrlApi("projectOrder/material/saveOrUpdate"),
    { data }
  );
};
//删除项目订单
export const deleteprojectOrder = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/deleteById"), { data });
};
//删除订单材料
export const deletematerial = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/material/deleteById"), {
    data
  });
};
//删除订单收货人
export const deleteconsignee = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/consignee/deleteById"), {
    data
  });
};
//获取材料列表
export const getmaterialselectlist = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/material/selectlist"), {
    params
  });
};
//供货完成
export const postsupplyFinished = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/supplyFinish"), {
    data
  });
};
//提交审批
export const postsubmitapproval = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/submit/approval"), {
    data
  });
};

//供应商确认
export const historylist = (params?: object) => {
  return http.request("get", baseUrlApi("/audit/confirm/history/list"), {
    params
  });
};

//订单确认
export const updatecommitAudit = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/commitAudit"), {
    data
  });
};

// 根据销售合同获取订单编号及名称
export const getOrderSnAndName = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/getSnAndName"), {
    params
  });
};

// 获取供货类型（部分供货/完全供货）
export const getSupplyTypeCheck = (params?: object) => {
  return http.request("get", baseUrlApi("projectOrder/check/supplyStatus"), {
    params
  });
};
//----------------------------------------验收清单----------------------------------------//
//获取验收清单列表
export const getposupplylist = (params?: object) => {
  return http.request("get", baseUrlApi("sosupply/list"), { params });
};
//获取验收清单详情
export const getposupplyinfo = (params?: object) => {
  return http.request("get", baseUrlApi("sosupply/info"), { params });
};
//获取验收清单材料列表
export const getposupplymaterial = (params?: object) => {
  return http.request("get", baseUrlApi("sosupply/material/list"), { params });
};
//获取验收清单合同数据列表
export const getsosupplywirepayinfo = (params?: object) => {
  return http.request("get", baseUrlApi("sosupply/wire/pay/info"), { params });
};
//供货清单生成对账单
export const getposupplysave = (data?: object) => {
  return http.request("post", baseUrlApi("sosupply/save"), { data });
};

//验收确认
export const getconfirmfinish = (data?: object) => {
  return http.request("post", baseUrlApi("sosupply/confirm/finish"), { data });
};

// 保存材料信息
export const saveposupplymaterial = (data?: object) => {
  return http.request("post", baseUrlApi("sosupply/material/save"), { data });
};

//----------------------------------------审批----------------------------------------//
// 项目订单审批
export const purchaseapplyApproval = (data?: object) => {
  return http.request("post", baseUrlApi("projectOrder/approval"), { data });
};
